<template>
  <a-tooltip placement="topLeft" @click="onClick">
    <template slot="title">
      <span>{{ value }}</span>
    </template>
    <span :class="isClick ? 'clickActive' : ''">{{ value | ellipsis(length) }}</span>
  </a-tooltip>
</template>

<script>
export default {
  name: 'JEllipsis',
  props: {
    value: {
      type: String,
      required: false
    },
    length: {
      type: Number,
      required: false,
      default: 25
    },
    isClick: {
      type: Boolean,
      required: false
    }
  },
  methods: {
    onClick() {
      this.$emit('clickEvent')
    }
  }
}
</script>

<style scoped>
.clickActive {
  cursor: pointer;
  color: #1890FF;
}
</style>
